package appconfig

import (
	"fmt"
	"github.com/mattermost/viper"
)

type AppConfig struct {
	MySQLConfig
	RedisConfig
}
type MySQLConfig struct {
	User     string
	Password string
	Host     string
	Port     int
	Database string
}
type RedisConfig struct {
	Host   string
	Port   int64
	Passwd string
}

var AppConf AppConfig

func InitAppConfig() {
	viper.SetConfigFile("./appconfig/test.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		fmt.Println("viper 配置失败")
		return
	}
	viper.Unmarshal(&AppConf)
}
